import java.util.Scanner;

public class Test111 {
    public static void main(String[] args) {
        hanoi(3,'A','B','C');
    }
    public static void hanoi(int num,char begin,char end,char middle){
        if(num == 1){
            System.out.println("从"+ begin +"移动到"+ end);
        }else{
            hanoi(num-1,begin,middle,end);
            System.out.println("从"+ begin +"移动到"+ end);
            hanoi(num-1,middle,end,begin);

        }
    }
    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请斐波那契数列的项数：");
        int n = scanner.nextInt();
        System.out.println("斐波那契数列的第"+n+"项为"+Fibonacci(n));
    }
    public static int Fibonacci(int m){
        if(m == 1|| m == 2){
            return 1;
        }else{
            return Fibonacci(m-1) + Fibonacci(m - 2);
        }
    }
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入数字：");
        int n = scanner.nextInt();
        System.out.println("和为：" + Decompose(n));
    }
    public static int Decompose(int x){
        int s = 0;
        if(x<10){
            return x;
        }else{
            return x % 10 + Decompose(x / 10);

        }
    }
    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入数字：");
        int n = scanner.nextInt();
        decompose(n);
    }
    public static void decompose(int x){
        if(x<10){
            System.out.print(x % 10 + " ");
        }else{
            decompose(x/10);
            System.out.print(x % 10 + " ");

        }
    }
    public static void main2(String[] args) {
        System.out.println("和为：" + sum(10));
    }
    public static int sum(int x){
        if(x == 1){
            return 1;
        }else {
            return x + sum(x - 1);
        }
    }

    public static void main1(String[] args) {
        //递归求 N 的阶乘
        System.out.println("8的阶乘为：" + factorial(10));
    }

    public static int factorial(int n){
        if(n==0){
            return 1;
        }else{
             return n*factorial(n-1);
        }
    }
}
